<template>
  <div>
    <el-dialog title="查看" :visible.sync="thistype" @close="fun(tname)">
      <el-form label-width="80px" :model="form" ref="form">
        <el-form-item label="题目">
            <span>{{form.title}}</span>
        </el-form-item>
        <el-form-item label="答案">
            <span>{{form.answer}}</span>
        </el-form-item>
        <el-form-item label="解析">
            <span>{{form.jiexi}}</span>
        </el-form-item>
      </el-form>
      {{tablerow}}
      <div slot="footer" class="dialog-footer">
        <el-button @click="thistype = false">取 消</el-button>
        <el-button type="primary" @click="thistype = false">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  props: ['type', 'fun', 'tname', 'tablerow'],
  data () {
    return {
      thistype: this.type, // 模态框状态
      form: {
        title: '',
        answer: '',
        jiexi: ''
      }
    }
  },

  watch: {
    type () {
      this.thistype = this.type
    },
    tablerow () {
      this.form = this.tablerow
    }
  }
}
</script>

<style>
</style>
